<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core">

<h:head>
	<meta http-equiv="Content-Type"
		content="text/html; charset=ISO-8859-1 " />
	<title>Cadastro de Usuarios</title>
</h:head>
<h:body>
	<h1>Cadastro de Usuarios</h1>
	<h:form id="cadastro">
		<h:messages />
		<h:inputHidden value="#{usuarioBean.usuario.codigo}" />
		<h:inputHidden value="#{usuarioBean.usuario.ativo}" />
		<h:inputHidden value="#{usuarioBean.destinoSalvar}" />

		<h:panelGrid columns="2">
			<h:outputLabel value="Nome:" for="nome" />
			<h:inputText id="nome" label="Nome"
				value="#{usuarioBean.usuario.nome}" size="30" maxlength="30"
				required="true" requiredMessaged="Voce nao tem nome?">
				<f:validateLength minimum="10" maximum="30" />
			</h:inputText>

			<h:outputLabel value="Data nascimento:" for="data" />
			<h:inputText id="data" label="Data nascimento"
				value="#{usuarioBean.usuario.nascimento}" size="10" maxlength="10"
				required="true">
				<f:convertDateTime dateStyle="medium" timeZone="GMT-3" pattern="dd/MM/yyyy" type="date" />
			</h:inputText>

			<h:outputLabel value="Celular:" for="celular" />
			<h:inputText id="celular" label="Celular"
				value="#{usuarioBean.usuario.celular}" size="10" />

			<h:outputLabel value="E-Mail:" for="email" />
			<h:panelGroup>
				<h:inputText id="email" label="E-Mail"
					value="#{usuarioBean.usuario.email}" size="50" maxlength="50"
					required="true" validatorMessage="E-Mail invalido!">
					<f:validateRegex pattern="[a-zA-Z0-9\-\_\.]+@[a-zA-Z0-9\-\_\.]+" />
				</h:inputText>
				<h:message for="email" />
			</h:panelGroup>

			<h:outputLabel value="Idioma:" form="idioma" />
			<h:selectOneMenu id="idioma" value="#{usuarioBean.usuario.idioma}">
				<f:selectItem itemValue="pt_BR" itemLabel="Portugues" />
				<f:selectItem itemValue="en_US" itemLabel="English" />
				<f:selectItem itemValue="es_ES" itemLabel="Espanhol" />
			</h:selectOneMenu>

			<h:outputLabel value="Login:" for="login" />
			<h:inputText id="login" label="Login"
				value="#{usuarioBean.usuario.login}" size="15" maxlength="15"
				required="true"
				validatorMessage="Login deve ter no minimo e no maximo 15 caracteres e so pode ter os sombolos '.' e '_'.">
				<f:validateRegex pattern="([a-z]|[0-9]|[.]|[_]){5,15}" />
			</h:inputText>

			<h:outputLabel value="Senha:" for="senha" />
			<h:inputSecret id="senha" label="Senha"
				value="#{usuarioBean.usuario.senha}" size="10" maxlength="10"
				required="true" redisplay="true" />

			<h:outputLabel value="Confirmar Senha: " for="confirmarsenha" />
			<h:inputSecret id="confirmarsenhha" label="Confirmar Senha"
				value="#{usuarioBean.confirmarSenha}" size="10" maxlength="10"
				required="true" redisplay="true"/>
		</h:panelGrid>
		<h:commandButton action="#{usuarioBean.salvar}" value="Salvar" />
		
		
	</h:form>
</h:body>
</html>